package only.level5.railgun.ysartifactsimulation.publisher;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import reactor.core.publisher.FluxSink;

import java.util.function.Consumer;

@Component
public class ArtifactInfoPublisher implements Consumer<FluxSink<String>> {

    private static final Logger log = LoggerFactory.getLogger(ArtifactInfoPublisher.class);

    FluxSink<String> sink;
    @Override
    public void accept(FluxSink<String> sink) {
        this.sink = sink;
    }
    public void sendData(String message) {
        if(sink == null){
            return;
        }
        sink.next(message);
    }
}
